<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>商品详情 - 校园二手交易平台</title>
    <link rel="stylesheet" href="/css/common.css">
    <link rel="stylesheet" href="/css/product.css">
    <link rel="stylesheet" href="/components/navbar.css">
</head>
<body>
    <!-- 插入导航栏 -->
    <div id="navbar-container"></div>

    <!-- 主要内容 -->
    <div class="container">
        <div id="product-message" class="message" style="display: none;"></div>

        <div class="product-container">
            <!-- 商品图片区域 -->
            <div class="product-gallery">
                <div class="image-loader">
                    <img src="/images/placeholder.jpg" alt="商品主图" class="main-image" loading="lazy">
                    <div class="loader"></div>
                </div>
                <div class="thumbnail-container">
                    <!-- 缩略图将由JavaScript动态填充 -->
                </div>
            </div>

            <!-- 商品信息区域 -->
            <div class="product-info">
                <h1 class="product-title">加载中...</h1>
                <div class="product-price">¥0.00</div>
                <div class="product-meta">
                    <span class="product-category">分类: 加载中...</span>
                    <span class="product-time">发布时间: 加载中...</span>
                </div>
                <p class="product-description">加载中...</p>

                <div class="seller-info">
                    <div class="seller-avatar">?</div>
                    <div class="seller-details">
                        <div class="seller-name">卖家: 加载中...</div>
                        <div class="seller-rating">信誉: 加载中...</div>
                    </div>
                </div>

                <div class="action-buttons">
                    <button class="action-button favorite-button" onclick="toggleFavorite()">
                        <span class="button-icon">❤</span> 收藏
                    </button>
                    <button class="action-button contact-button" onclick="contactSeller()">
                        <span class="button-icon">💬</span> 联系卖家
                    </button>
                </div>
            </div>
        </div>

        <!-- 评论区 -->
        <div class="comments-section">
            <div class="comments-header">
                <h2>商品评论</h2>
                <span class="comments-count">(0条)</span>
            </div>

            <form class="comment-form" onsubmit="submitComment(event)">
                <textarea class="comment-input" placeholder="写下你的评论..." required></textarea>
                <div class="form-footer">
                    <span class="comment-hint">至少输入10个字符</span>
                    <button type="submit" class="comment-submit">发表评论</button>
                </div>
            </form>

            <div class="comment-list">
                <div class="no-comments">暂无评论，快来抢沙发~</div>
            </div>
        </div>
    </div>

    <!-- 图片预览模态框 -->
    <div class="modal" id="image-modal" style="display: none;">
        <div class="modal-content">
            <span class="close-button" onclick="closeModal()">&times;</span>
            <img class="modal-image" src="" alt="预览图">
        </div>
    </div>


    <!-- 公共脚本 -->
    <script src="/js/jquery.min.js"></script>
    <script src="/js/common.js"></script>
    <!-- 动态加载导航栏 -->
    <script>
    $(function(){
        $("#navbar-container").load("/components/navbar.html");
    });
    </script>
    <!-- 页面专属脚本 -->
    <script src="/js/product.js"></script>
</body>
</html>
